package com.lxit.dao;

import com.lxit.pojo.Scheduling;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface SchedulingMapper {
    @Delete({
        "delete from tb_scheduling",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into tb_scheduling (id, exam_type_id, ",
        "exam_id, class_id, ",
        "student_list, starttime, ",
        "endtime, examtime)",
        "values (#{id,jdbcType=INTEGER}, #{examTypeId,jdbcType=INTEGER}, ",
        "#{examId,jdbcType=INTEGER}, #{classId,jdbcType=INTEGER}, ",
        "#{studentList,jdbcType=VARCHAR}, #{starttime,jdbcType=TIMESTAMP}, ",
        "#{endtime,jdbcType=TIMESTAMP}, #{examtime,jdbcType=TIMESTAMP})"
    })
    int insert(Scheduling record);

    int insertSelective(Scheduling record);

    @Select({
        "select",
        "id, exam_type_id, exam_id, class_id, student_list, starttime, endtime, examtime",
        "from tb_scheduling",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    Scheduling selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Scheduling record);

    @Update({
        "update tb_scheduling",
        "set exam_type_id = #{examTypeId,jdbcType=INTEGER},",
          "exam_id = #{examId,jdbcType=INTEGER},",
          "class_id = #{classId,jdbcType=INTEGER},",
          "student_list = #{studentList,jdbcType=VARCHAR},",
          "starttime = #{starttime,jdbcType=TIMESTAMP},",
          "endtime = #{endtime,jdbcType=TIMESTAMP},",
          "examtime = #{examtime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Scheduling record);
}